﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Diagnostics;

public partial class YHGL_RZCX : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!Page.IsPostBack)
    {
      if (!ProjectPrivate.GetQX("51"))
      {
        Server.Transfer("~\\blank.aspx");
      }
      date1.Text = DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01";
      date2.Text = DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString()
        + "-" + DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month).ToString();
      cblYQXZ.DataTextField = "yqxz";
      cblYQXZ.DataValueField = "yqxzid";
      cblYQXZ.DataSource = YQXZ.GetDS();
      cblYQXZ.DataBind();
    }
    BindGrid();

  }

  protected void BindGrid()
  {
    DataSet ds = JGTZ.GetRZ();
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }

  protected void btnQuery_Click(object sender, EventArgs e)
  {
    List<CommandInfo> cis = new List<CommandInfo>();

    string sID = CommonUse.GetID("sjlr_jgtzsj", "id");
    string yqxz = "";
    foreach (ListItem li in cblYQXZ.Items)
    {
      if (li.Selected)
        yqxz += li.Text + ",";
    }
    yqxz = yqxz.Trim(new char[] { ',' });
    CommandInfo ci = JGTZ.JGTZ_Insert(sID, date1.Text, date2.Text, SysManage.Get_User, yqxz);
    cis.Add(ci);
    if (DbHelperSQL.ExecuteSqlTran(cis) > 0)
    {
      BindGrid();
    }

  }
  protected void btn_Click(object sender, EventArgs e)
  {

  }
}